﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Message;
using Base;

public partial class member_Message_Message : nspBase.MemberBasePge
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CheckCookies())
        {
            Response.Redirect("../../login/login.aspx");
        }
        if (!IsPostBack)
        {
            bind();
        }
    }
    ///**************************************************
    /// <summary>
    /// depiction：实现对的留言的绑定
    /// </summary>
    /// <param name="<参数名称>"><参数说明></param>
    /// <returns>
    ///<对方法返回值的说明，该说明必须明确说明返回的值代表什么含义>
    /// </returns>
    ///Writer：作者中文名
    ///Create Date：<方法创建日期，格式：YYYY-MM-DD>
    ///**************************************************

    private void bind()
    {
        int id=0;
        btnDelete.Attributes.Add("onclick", "javascript:return confirm('你确认要删除吗?')");
        if(Request.QueryString["ID"]!=null)
        id = int.Parse(Request.QueryString["ID"].ToString());

        //定义IUserInfo接口
        IMessage RM = new RMessage();
        //返回全部会员
        TMessage TM = RM.GateItem(id);

        this.lblDate.Text = TM.Date.ToString();
        this.lblInfo.Text = TM.Info.ToString();
        this.lblTitle.Text = TM.Title.ToString();
        //this.CompanyName.InnerText = tu.CompanyName.ToString();


        UserInfo.TUserInfo tu = new UserInfo.TUserInfo();
        UserInfo.IUserInfo iu = new UserInfo.RUserInfo();
        tu = iu.GateItem(int.Parse(TM.ReceiveUserID.ToString()));
        this.CompanyName.InnerText = tu.CompanyName;
        
    }
    
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int id = int.Parse(Request.QueryString["ID"].ToString());
        IMessage RM = new RMessage();
        RM.Delete(id);
        ShowMessage("删除留言成功！", "Message/SendMessage.aspx");
    }

    protected void btnReturn_Click(object sender, EventArgs e)
    {
        Response.Redirect("SendMessage.aspx");
    }
}
